package com.example.flying_personnel_management_system.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.example.flying_personnel_management_system.pojo.SysUser;
import com.example.flying_personnel_management_system.services.YuServiceDao;
import com.example.flying_personnel_management_system.services.YuServiceDaoImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class LiController {
    @Autowired
    YuServiceDaoImp yuServiceDaoImp;


    //点击查看跳转页面查看系统管理员用户管理查询信息
    @RequestMapping(path = "/userSelectAllYuGo")
    public String userSelectAllYuGo(){
        return "LhyOne";
    }

    //查看系统管理员用户管理查询信息
    @RequestMapping(path = "/userSelectAllYu",method = RequestMethod.POST)
    @ResponseBody
    public JSONArray userSelectAllYu(){
        List list=yuServiceDaoImp.selectAllYu();
        JSONArray array= JSONArray.parseArray(JSON.toJSONString(list));
        return array;
    }

    //查看系统管理员用户管理新增信息
    @RequestMapping(path = "/userInsertYu",method = RequestMethod.POST)
    @ResponseBody
    public String  userInsertYu(SysUser sysUser){
        return JSON.toJSONString(yuServiceDaoImp.insertYu(sysUser));
    }
}
